﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    /// <summary>
    /// 轨迹类
    /// </summary>
    public class Trajectory
    {
        //像素点集合
        public List<Point> Points { get; set; }
        public Color Color { get; set; }
        public int CurrentStep { get; set; }

        public Trajectory(Color color)
        {
            Points = new List<Point>();
            Color = color;
            CurrentStep = 0;
        }

        public void AddPoint(Point point)
        {
            Points.Add(point);
        }

        public void Draw(Graphics g)
        {
            for (int i = 0; i < Math.Min(CurrentStep, Points.Count - 1); i++)
            {
                using (Pen pen = new Pen(Color, 2))
                {
                    g.DrawLine(pen, Points[i], Points[i + 1]);
                }
            }
        }
    }
}
